package com.sviet.game.tetriswindow.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

public class SharedPreferencesUtils {
	private static String TAG = SharedPreferencesUtils.class.getSimpleName();
	
	public static final String CONTROL_MODE = "control_mode";
	public static final String LINE = "line";
	public static final String SCORE = "score";
	
	public static void SetPreference(Context context, String key, int value) {
		Log.v(TAG, "SetPreference");
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);

		SharedPreferences.Editor editor = prefs.edit();
		editor.putInt(key, value);
		editor.commit();
	}

	public static int GetPreference(Context context, String key) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		return prefs.getInt(key, 0);
	}
}
